import InputCheck.InputCheck;
import book.Bookshelf;
import user.AdminUser;
import user.NormalUser;
import user.User;


import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28318
 * Date: 2025-10-25
 * Time: 15:03
 */

public class Main {

    public static User login(){
        Scanner inPut = new Scanner(System.in);
        System.out.println("请输入您的姓名:");
        String name = inPut.nextLine();
        System.out.println("请输入您的ID:(1为管理员,其他为普通用户)");
        InputCheck check = new InputCheck();
        int userID = check.ExceptionCheck();
        if(userID == 1){
            return new AdminUser(name,userID);
        }else{
            return new NormalUser(name,userID);
        }
    }



    public static void main(String[] args) {
        Bookshelf book = new Bookshelf();
        User user = login();
        while (true) {
            int choice = user.menu();
            user.doIoperation(choice,book);
            if (choice == 0){
                break;
            }
        }
    }
}